<template>
	<view>
		<view  style="padding: 20rpx;">
			<u-search placeholder="搜索视频内容" @custom="upData" v-model="title"></u-search>
		</view>
		<goodsVideoList :goodsList="goodsList" 
			:scrollHeight="`calc(100vh - ${domHeight}px)`" marginNum="20rpx 30rpx 40rpx 30rpx" 
			titleText="推荐挑战" bannerShow :fastIndex="true"/>
	</view>
</template>
<script>
	import goodsVideoList from '@/components/goodsVideoList/goodsVideoList.vue'
	export default {
		components: {
			goodsVideoList
		},
		data() {
			return {
				domHeight:0,
				goodsList:[],
				title:''
			}
		},
		onShow() {
			this.upData()
		},
		onShareAppMessage (){},
		methods: {
			upData() {
				let data = {
					title: this.title
				}
				this.$myRuquest('home/index/play_list', data).then(res => {
					let goodsList=[]
					goodsList.push(...res.data.list) 
					this.$myRuquest('home/online/online_type',).then(res => {
						let list = []
						res.data.forEach(item=>{
							item.pic='https://wjlm.goldsu.cn'+item.pic
							item.type=99,
							item.desc=''
							
							if(!this.title||item.title.indexOf(this.title)!==-1) list.push(item)
						})
						goodsList.push(...list)
						goodsList.sort(function() {
							return Math.random() - 0.5
						})
						this.goodsList = goodsList
					})
					
				})
				
				
				
			},
	
		}
	}
</script>

<style>

</style>
